from flask import abort, request, Blueprint
from app import JR
from app.data.car_flow import *
import time

api = Blueprint('api', __name__)


@api.route('/car_flow/predict/', methods=['POST'])
def car_flow_predict():
    # if not request.json or 'id' not in request.json or 'info' not in request.json:
    #     abort(400)
    # params = {
    #     'id': request.json['id'],
    #     'info': request.json['info']
    # }
    # print(params)

    # 统计历史数据

    # 获取统计数据
    df = fetch_data('2021-01-01', time.strftime("%Y-%m-%d", time.localtime()))
    # 调用预测算法得出结果
    result_list = []

    # 持久化预测结果
    save_data(result_list)

    return JR().success()
